package com.itheima.protocol.clone;

public class CloneDemo {

    public static void main(String[] args) throws Exception {

        Person person = new Person();
        person.setName("校长");

        Student student = new Student();
        student.setName("学生");
        student.setAge(20);
        student.setPerson(person);

        //克隆一个对象
        Student student1 = (Student)student.deepClone();
        System.out.println(student);

        student1.getPerson().setName("Tom");
        System.out.println(student1);
    }
}
